<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{.title}} - MiniBug</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <style>
        .status-open { @apply bg-red-100 text-red-800; }
        .status-in_progress { @apply bg-yellow-100 text-yellow-800; }
        .status-resolved { @apply bg-green-100 text-green-800; }
        .status-closed { @apply bg-gray-100 text-gray-800; }
        
        .priority-low { @apply bg-blue-100 text-blue-800; }
        .priority-medium { @apply bg-yellow-100 text-yellow-800; }
        .priority-high { @apply bg-orange-100 text-orange-800; }
        .priority-critical { @apply bg-red-100 text-red-800; }
    </style>
</head>
<body class="bg-gray-50">
    <nav class="bg-white shadow-sm border-b">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between h-16">
                <div class="flex items-center">
                    <a href="/bugs" class="text-xl font-bold text-gray-900">MiniBug</a>
                </div>
                <div class="flex items-center space-x-4">
                    <span id="user-info" class="text-sm text-gray-700"></span>
                    <button onclick="logout()" class="text-sm text-gray-500 hover:text-gray-700">退出</button>
                </div>
            </div>
        </div>
    </nav>
    
    <main class="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8">
        {{.content}}
    </main>
    
    <script>
        // 检查登录状态
        function checkAuth() {
            $.ajax({
                url: '/api/bugs',
                method: 'GET',
                success: function() {
                    // 已登录
                },
                error: function() {
                    window.location.href = '/login';
                }
            });
        }
        
        // 退出登录
        function logout() {
            $.ajax({
                url: '/api/logout',
                method: 'POST',
                success: function() {
                    window.location.href = '/login';
                }
            });
        }
        
        $(document).ready(function() {
            checkAuth();
        });
    </script>
</body>
</html>
